#ifndef TRAN_SRV_H
#define TRAN_SRV_H

#include <QtCore>

//前置声明
class CRTDB;
class CBattStack;
class QTranslator;
class CModbusFactory;
class CDataTranSrv;
class QTimer;
class CAppIniFile;
class CLogFile;

class CTranSrv : public QObject//通讯服务核心模块
{//业务主控制器
	Q_OBJECT
public:
	CTranSrv(QObject *parent = 0);
	~CTranSrv();

public:	
	int init();
	void startSrv();
    void WriteLog(const QString& strLog);

public slots:
    void switchLang();

private:
    bool openDB();
    void CheckLogFile();
    void Init();
    void InitMembers();

private slots:
	void saveRemoteSetParam();

private:
    CRTDB*              m_pRTDB;
    CBattStack*         m_pBattStack;
    QTranslator*        m_pTranslator;
    CModbusFactory*     m_pModbusFactory;//Modbus工厂，用于生成主/从设备
    CDataTranSrv*       m_pDataTranSrv;

    QString             m_strDriver;      // DB Information
    QString             m_strIP;
    ushort              m_usPort;
    QString             m_strDBName;
    QString             m_strUserName;
    QString             m_strPwd;
    QTimer*             m_pTimer;    //定时任务用，如周期性存储或刷新
    CAppIniFile*        m_pIniFile;         //配置文件，配置文件解析
    CLogFile*           m_pLogFile;         //日志文件，日志记录类
};

extern CTranSrv* g_pLogic;

#endif // TRAN_SRV_H
